function LoginAssistant(argFromPusher) {
}

LoginAssistant.prototype = {
	setup: function() {
		Ares.setupSceneAssistant(this);
		if(localStorage.getItem("username") && localStorage.getItem("password")){
			this.$.usernameBox.setValue(localStorage.getItem("username"));
			this.$.passwordBox.setValue(localStorage.getItem("password"));
			this.button1Tap();
		}
	},
	cleanup: function() {
		Ares.cleanupSceneAssistant(this);
	},
	button1Tap: function(inSender, event) {
		var args = { username: this.m_username.value, password: this.m_password.value };
		var this1 = this;
		drupalService('user.login', args, this, function(data) {
			localStorage.setItem("sessid", data.sessid);
			user = data.user;
			if(this1.$.autoLogin.getValue()){
				localStorage.setItem("username", this1.m_username.value);
				localStorage.setItem("password", this1.m_password.value);
			}
			Mojo.Controller.stageController.popScenesTo();
			Mojo.Controller.stageController.pushScene("home",{parent: 0});
			loadProducts(false);
			loadMenu(false);
		});
	},
	button2Tap: function(inSender, event) {
		Mojo.Controller.stageController.pushScene("register"); 
	}
	
};